First example: A three cohort, three cycle study

library(FAIRsimulator)
set.seed(3243)

Create the study

The first step is to create an initial study object.

StudyObjIni <- createStudy(
  recruitmentAges = list(c(0,1)*30,c(6,7)*30,c(12,13)*30),
  nSubjects = c(300,300,300),
  Recruitmentfunction=function(...) {return(5000)},
  samplingDesign = list(0:6*30, c(0,3,6)*30, c(0,3,6)*30),
  studyStopTime = 18*30+3,
  latestTimeForNewBirthCohorts=0*30,
  treatments =list(
    c("SoC-1","TRT-1","TRT-2","TRT-3","TRT-4"),
    c("SoC-2","TRT-5","TRT-6","TRT-7","TRT-8"),
    c("SoC-3","TRT-9","TRT-10","TRT-11","TRT-12")),
  effSizes = list(c(0,0.05,0.1,0.15,0.25),
                  c(0,0.05,0.1,0.15,0.25),
                  c(0,0.05,0.1,0.15,0.25)),
  randomizationProbabilities = list(rep(0.20,5),rep(0.20,5),rep(0.20,5)),
  strCovariates = c("BIRTHWT","MAGE", "MHTCM", "SEXN", "SANITATN"),
  minAllocationProbabilities = list(c(0.2,rep(0,4)),c(0.2,rep(0,4)),c(0.2,rep(0,4)))
  )

The above design choices can be changed by the user.

Run the study

The study is simulated with the AdaptiveStudy function.

StudyObj<-AdaptiveStudy(StudyObjIni)

Visualise the results

The design of the trial

The plotStudyCohorts function provides a high level picture of the study.

plotStudyCohorts(StudyObj,plotAnaTimes = T)

The number of subjects remaining

plotActiveSubjects(StudyObj)

The simulated HAZ data

The simulated HAZ values can be inspected using the plotHAZ function.

plotHAZ(StudyObj)

The randomization probabilities

The randomization probabilities before any modifications can be visualized with the plotProbs function while specifying strProb="UnWeightedUpdateProbabilities.

plotProbs(StudyObj,strProb="UnWeightedUpdateProbabilities")

The probabilities after modifications can also be plotted. The SoC probabilities are reset to 0.2 and TRT-9 and TRT-10 are deemed futile (set to 0). TRT-8 falls below a probability of 0.1. This is because the futility evaluation happens before the probabilities are adjusted to accommodate minimum allocation levels.

plotProbs(StudyObj,strProb="UpdateProbabilities")

Second example:

Create the study

This study is the same as the one in the first example except that new cohorts are included in the youngest age group. The randomization probabilities for the new cohorts are based on the analys of the cohort preceeding it.

set.seed(32423)

probTemperation <- function(probs) {
  probs <- sqrt(probs)/sum(sqrt(probs))
  return(probs)
}

StudyObjIni <- createStudy(
  recruitmentAges = list(c(0,1)*30,c(6,7)*30,c(12,13)*30),
  nSubjects = c(300,300,300),
  Recruitmentfunction=function(...) {return(5000)},
  samplingDesign = list(0:6*30, c(0,3,6)*30, c(0,3,6)*30),
  studyStopTime = 32*30,
  latestTimeForNewBirthCohorts=18*30,
  treatments =list(
    c("SoC-1","TRT-1","TRT-2","TRT-3","TRT-4"),
    c("SoC-2","TRT-5","TRT-6","TRT-7","TRT-8"),
    c("SoC-3","TRT-9","TRT-10","TRT-11","TRT-12")),
  effSizes = list(c(0,0.05,0.1,0.15,0.25),
                  c(0,0.05,0.1,0.15,0.25),
                  c(0,0.05,0.1,0.15,0.25)),
  randomizationProbabilities = list(rep(0.20,5),rep(0.20,5),rep(0.20,5)),
  strCovariates = c("BIRTHWT","MAGE", "MHTCM", "SEXN", "SANITATN"),
  minAllocationProbabilities = list(c(0.2,rep(0,4)),c(0.2,rep(0,4)),c(0.2,rep(0,4)))
  )

Run the study and look at the design

StudyObj <- AdaptiveStudy(StudyObjIni)
plotStudyCohorts(StudyObj)

Plot the probabilities

The unadjusted probabilities:

plotProbs(StudyObj,strProb="UnWeightedUpdateProbabilities")

The adjusted probabilities:

plotProbs(StudyObj)
#plotProbs(StudyObj,strProb="UnWeightedRandomizationProbabilities")


eniclas/FAIRsimulator documentation built on May 16, 2019, 5:12 a.m.